home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.1 (Developer) [x86] / NeXT Step 3.1 Intel dev.cdr.dmg / NextDeveloper / Examples / AppKit / Graph / LineGraph.h < prev    next >
Text File  |  1992-04-19  |  2KB  |  52 lines

  1.  
  2. #import <appkit/View.h>
  3.  
  4. @interface LineGraph : View {
  5.     float *points;    /* coords of the userpath used to draw graph */
  6.     int numPoints;    /* number of points in the graph */
  7.     float bbox[4];    /* bounding box of graph - minx, miny, maxx, maxy */
  8.     char *ops;        /* operator array of the userpath used to draw graph */
  9.     float lineGray;    /* gray value for the line of the graph */
  10.     float backgroundGray;    /* gray value for the background */
  11. }
  12.  /*
  13.   * LineGraph is simple view which plots an xy graph of a series of points.
  14.   * You use it by setting the x and y coords of the points of the graph, and
  15.   * then tell it to display.  In addition, it will also zoom and rescale
  16.   * itself so the whole graph is visible.
  17.   */
  18.  
  19. - initFrame:(NXRect *)aRect;
  20.  /* Called as part of nib instantiation. */
  21.  
  22. - setPoints:(int)num x:(float *)x y:(float *)y
  23.     minX:(float)minX minY:(float)minY maxX:(float)maxX maxY:(float)maxY;
  24.  /*
  25.   * Sets the points of the graph.  Num is the number of points, x and y are
  26.   * arrays of coordinates.  The other parameters are the boundaries of the
  27.   * coordinates you pass in.
  28.   */
  29.  
  30. - scaleToFit;
  31.  /*
  32.   * Scales the view to that the whole graph is within the view.
  33.   */
  34.  
  35. - zoom:(float)scale;
  36.  /*
  37.   * Zooms the view by the given scale.  A factor of 2 makes the image twice
  38.   * as large.
  39.   */
  40.  
  41. - setLineGray:(float)gray;
  42. - setBackgroundGray:(float)gray;
  43. - (float)lineGray;
  44. - (float)backgroundGray;
  45.  /*
  46.   * Methods to set and get the gray values used to draw the line and
  47.   * background of the graph.
  48.   */
  49.  
  50.  
  51. @end
  52.